workspace "FysicsEngineLight"
	architecture "x64"
	startproject "Sandbox"

	configurations
	{
		"Debug",
		"Release",
		"Dist"
	}


outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
IncludeDir = {}
IncludeDir["GLFW"] = "FysicsEngineLight/vendor/GLFW/include"
IncludeDir["GLAD"] = "FysicsEngineLight/vendor/glad/include"
IncludeDir["ImGui"] = "FysicsEngineLight/vendor/imgui"
IncludeDir["glm"] = "FysicsEngineLight/vendor"
IncludeDir["opencv"] = "packages/opencv4.2.2020.5.26/build/native/include"

include "FysicsEngineLight/vendor/GLFW"
include "FysicsEngineLight/vendor/GLAD"
include "FysicsEngineLight/vendor/imgui"

project "FysicsEngineLight"
	location "FysicsEngineLight"
	kind "SharedLib"
	language "C++"

	targetdir ("bin/" .. outputdir .. "/%{prj.name}")
	objdir ("bin-int/" .. outputdir .. "/%{prj.name}")

	-- C/C++：预编译头
	pchheader "fepch.h"
	pchsource "FysicsEngineLight/src/fepch.cpp"

	files
	{
		"%{prj.name}/src/**.h",
		"%{prj.name}/src/**.cpp",
		"%{prj.name}/vendor/glm/**.hpp",
		"%{prj.name}/vendor/glm/**.inl"
	}

	-- C/C++：常规：附加包含目录
	includedirs
	{
		"%{prj.name}/src",
		"%{IncludeDir.GLFW}",
		"%{IncludeDir.GLAD}",
		"%{IncludeDir.ImGui}",
		"%{IncludeDir.glm}"
	}

	-- 链接器：输入：附加依赖项
	links
	{
		"GLFW",
		"GLAD",
		"ImGui",
		"opengl32.lib"
	}

	-- 链接器：常规：附加库目录
	-- libdirs
	-- {
	-- 	"%{prj.name}/vendor/GLFW/lib-vc2015"
	-- }

	filter "system:windows"
		cppdialect "C++17"
		staticruntime "On"
		systemversion "latest"

		defines
		{
			"FE_PLATFORM_WINDOWS",
			"FE_BUILD_DLL",
			"FE_ENABLE_ASSERTS",
			"GLFW_INCLUDE_NONE"
		}

		postbuildcommands
		{
			("{COPY} %{cfg.buildtarget.relpath} ../bin/" .. outputdir .. "/Sandbox")
		}

	filter "configurations:Debug"
		defines "FE_DEBUG"
		symbols "On"
		buildoptions "/MDd"		-- C/C++：代码生成：运行库

	filter "configurations:Release"
		defines "FE_RELEASE"
		optimize "On"
		buildoptions "/MD"

	filter "configurations:Dist"
		defines "FE_DIST"
		optimize "On"
		buildoptions "/MD"


project "Sandbox"
	location "Sandbox"
	kind "ConsoleApp"
	language "C++"

	targetdir ("bin/" .. outputdir .. "/%{prj.name}")
	objdir ("bin-int/" .. outputdir .. "/%{prj.name}")

	files
	{
		"%{prj.name}/src/**.h",
		"%{prj.name}/src/**.cpp"
	}

	includedirs
	{
		"FysicsEngineLight/src",
		"%{IncludeDir.GLFW}",
		"%{IncludeDir.glm}",
	}

	links
	{
		"FysicsEngineLight"
	}

	filter "system:windows"
		cppdialect "C++17"
		staticruntime "On"
		systemversion "latest"

		defines
		{
			"FE_PLATFORM_WINDOWS"
		}

	filter "configurations:Debug"
		defines "FE_DEBUG"
		symbols "On"
		buildoptions "/MDd"

	filter "configurations:Release"
		defines "FE_RELEASE"
		optimize "On"
		buildoptions "/MD"

	filter "configurations:Dist"
		defines "FE_DIST"
		optimize "On"
		buildoptions "/MDd"